package template;

public class HexNode {
	public HexNode l, r, ul, ur, dl, dr;
	public boolean checked, edge;
	public int x, y, status, id;
	//position/coordinate may not be used/useful in this context
	/**default hex state*/
	final static int empty=0;		
	/**this hex is "linked" to the other side/edge*/
	final static int linkedPlayer=1;
	/**this hex belongs to the player*/
	final static int player=10;		
	/**don't count this hex for template matching*/
	final static int marked=2;		

	final static int opponent=3;
	//need identifier for marked(this player, other player), unmarked 
	static int counter =0;
	HexNode(){
		l= r= ul= ur= dl= dr = null;
		checked= edge = false;
		x= y= status = 0;
		counter++;
		id = counter;
	}
	

	static void mirror(HexNode in){
		if(in.ul != null)mirror(in.ul);
		if(in.ur != null)mirror(in.ur);
		if(in.l != null)mirror(in.l);
		if(in.r != null)mirror(in.r);
		if(in.dl != null)mirror(in.dl);
		if(in.dr != null)mirror(in.dr);
		HexNode temp = in.ul;
		in.ul = in.ur;
		in.ur = temp;
		
		temp = in.l;
		in.l = in.r;
		in.r = temp;

		temp = in.dl;
		in.dl = in.dr;
		in.dr = temp;
		
	}
	
}
